<?php 
defined('IN_TS') or die('Access Denied.');

$page = isset($_GET['page']) ? intval($_GET['page']) : 1;

if(!$TS_USER['isadmin']){
    tsNotice('你没有操作权限！');
}

$arr = 'trade_status="TRADE_SUCCESS"';

$lstart = $page*30-30;

$url = tsUrl('gift','tradelist',array('page'=>''));

//全部交易
$arrTrade = $new['gift']->findAll('pay_user',$arr,'addtime desc',null,$lstart.',30');
foreach($arrTrade as $key=>$item){
    $strGiftUser = aac('gift')->find('gift_users',array('orderid'=>$item['orderid']));
    $gift = aac('gift')->find('gift',array('giftid'=>$strGiftUser['giftid']));
    $seller = aac('user')->find('user_info',array('userid'=>$gift['userid']));
    $arrTrade[$key]['gift'] = $gift;
    $arrTrade[$key]['seller'] = $seller;
    $buyer = aac('user')->find('user_info',array('userid'=>$item['userid']));
    $arrTrade[$key]['buyer'] = $buyer;
}



$pageUrl = pagination($giftNum, 30, $page, $url);

$title = '交易记录';
include template("tradelist");